package com.bird.utils;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;

public class Log {
	
	public static void log(String text){
		String path = Log.class.getResource("").getPath().substring(1);
		path = path.replaceAll("%20", " ");
		path = path.substring(0,path.indexOf("Rookie"));
		path = path + "\\"+"log.txt";
		System.out.println(path);
		try{
			File file = new File(path);
			if(!file.exists()){
				file.createNewFile();
			}
			System.out.println(file.getAbsolutePath());
			
			BufferedWriter writer = new BufferedWriter(new FileWriter(file,true));
			writer.append(text+"\r\n");
			writer.flush();
			writer.close();
		}catch(Exception e){
			e.printStackTrace();}
		}
	
}
